import tkinter as tk
def click():
    i=0
    s=text.get()
    while i<len(s):
        c=s[i:i+2]
        if c=="00":
            d="东"
        elif c=="01":
            d="南"
        elif c=="10":
            d="西"
        else:
            d="北"
        b1=int(s[i+2])
        b2=int(s[i+3])
        v=b1*2+b2
        list1.insert("end","           "+d+"         "+str(v))
        i=i+4
        
win=tk.Tk()
win.title("编码翻译")
list1=tk.Listbox(win)
lb2=tk.Label(win,text='方向     距离')
text=tk.Entry(win)
btn=tk.Button(win,text='翻译',command=click)

text.grid(row=0, column=0,columnspan=2)
lb2.grid(row=1,column=0)
list1.grid(row=2,column=0)
btn.grid(row=2,column=1)
win.mainloop()
